package com.coderdream.chapter05.singleton.a3;

public class Singleton {


	private static Singleton  singleton = new Singleton();
	
	private Singleton() {
		System.out.println("已產生實例對象");
		this.slowdown();
	}
	
	public static synchronized Singleton getInstance() {
		if (singleton == null) {
			singleton = new Singleton();
		}
		
		return singleton;
	}
	
	private void slowdown() {
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
